﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ARR.Entities.Validation.ComponentModel;
using ARR.Entities.ComponentModel;
using ARR.Entities.Validation.Common;
using ARR.Shared;

namespace ARR.Entities.Validation
{
    [Serializable]
    public class ArticleInputValidations : InputValidationBase
    {
        private Article article;

        public ArticleInputValidations(Article article)
        {
            this.article = article;
        }

        public override List<ValidationBase> CreateValidations()
        {
            List<ValidationBase> inputValidations = new List<ValidationBase>();

            //LG: Comentado para probar si mejora performance

            //inputValidations.Add(new Required("Code", Labels.Codigo));
            //inputValidations.Add(new StringLength("Code", 20, Labels.Codigo));

            //inputValidations.Add(new Required("Name", Labels.Nombre));
            //inputValidations.Add(new StringLength("Name", 200, Labels.Nombre));

            //inputValidations.Add(new StringLength("EAN", 50, Labels.EAN));
            //inputValidations.Add(new StringLength("UOM", 50, Labels.UOM));
            //inputValidations.Add(new StringLength("Brand", 255, Labels.Marca));
            //inputValidations.Add(new StringLength("Manufacturer", 255, Labels.Fabricante));

            //inputValidations.Add(new CustomValidation("Country", string.Format(Errors.RequiredValidation, Labels.Pais), delegate()
            //{
            //    return article.Country != null
            //            && article.CountryId > 0
            //            && !string.IsNullOrWhiteSpace(article.Country.Name);
            //}));

            //inputValidations.Add(new CustomValidation("Category", string.Format(Errors.RequiredValidation, Labels.Categoria), delegate()
            //{
            //    return article.Category != null
            //           && article.CategoryId > 0
            //           && !string.IsNullOrWhiteSpace(article.Category.Name);
            //}));


            return inputValidations;
        }
    }
}
